package good.idea.data.demo.score;

import good.idea.data.excel.call.DataLoadChannel;
import good.idea.data.excel.domain.PageData;
import good.idea.data.excel.write.ExcelWriteTask;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ScoreSubDataLoadChannel implements DataLoadChannel {


    @Override
    public Object loadData(PageData pageData, ExcelWriteTask writeTask, Object item) {

        Map p = (Map) item;
        Integer pageIndex = (Integer) p.get("pageIndex");
        List list = new ArrayList();
        if (pageIndex != null) {

            for (int i = 0; i < 32; i++) {
                Map map = new HashMap<>();
                map.put("userName", "张" + i);
                map.put("no", pageIndex * 31 + i + 1);
                map.put("mony", new Double("12" + i + ".56"));
                list.add(map);
            }
        }

        if (pageData.getCurrPage() > 0) {
            return null;
        }
        return list;
    }
}
